Skip to content

Fix #11415: always expand bounds in type approximation #11418

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Feb 15, 2021

Conversation

liufengyun
Copy link
Contributor

@liufengyun liufengyun commented Feb 15, 2021

Fix #11415: always expand bounds in type approximation

Related PR #11192

@liufengyun
Copy link
Contributor Author

@bishabosha I just verified it locally, it fixes the crash. What is the best way to test it?

@bishabosha
Copy link
Member

@liufengyun either in the sbt-dotty/sbt-test/scala2-compat directory, or we can try to copy the definitions from scala reflect and see if the issue can be reproduced

@bishabosha
Copy link
Member

@liufengyun i can recreate the issue with this test

package example

import scala.language.experimental.macros

trait Context {

  val universe: Universe

  trait Universe {
    type Tree >: Null <: AnyRef with TreeApi
    type Literal >: Null <: LiteralApi with TermTree
    type TermTree >: Null <: TermTreeApi with Tree

    trait TermTreeApi extends TreeApi { this: TermTree => }
    trait LiteralApi extends TermTreeApi { this: Literal => }
    trait TreeApi extends Product { this: Tree => }
  }
}

object MacroCompat {

  object Bundles {
    def mono: Int = macro Macros2.MacroImpl.mono
    inline def mono: Int = ${ Macros3.monoImpl }
  }

  object Macros2 {
    class MacroImpl(val c: Context) {
      import c.universe._

      def mono: Literal = ???
    }
  }

  object Macros3 {
    import quoted._

    def monoImpl(using Quotes) = '{1}

  }

}

@liufengyun
Copy link
Contributor Author

@bishabosha Very helpful, thanks 👍

@odersky
Copy link
Contributor

odersky commented Feb 15, 2021

Thanks for the quick fix, @liufengyun !

@odersky odersky merged commit 7e1def2 into scala:master Feb 15, 2021
@odersky odersky deleted the fix-11415 branch February 15, 2021 17:19
@Kordyjan Kordyjan added this to the 3.0.0 milestone Aug 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Regression when compiling scala 2 macro bundle
4 participants